package com.cn.study0011.Test009;

import com.cn.study0011.Test008.Menu;

import java.util.Scanner;

/**
 * @author lw
 * @ClassName StartSMS.java
 * @Description
 * @createTime 2023年05月16日 22:27:00
 */
public class StartSMS {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        User user = new User();
        Menu menu = new Menu();
        menu.showLoginMeun();
        int i = 0;
        do {
            if (sc.hasNextInt()) {
                i = sc.nextInt();
                if (i == 1) {
                    for (int j = 1; j <=3 ; j++) {
                        menu.showLoginMeun();
                        System.out.print("\n请输入用户名：");
                        String n=sc.next();
                        System.out.print("请输入密码：");
                        String p=sc.next();
                        if (user.name.equals(n)&&user.password.equals(p)){
                            System.out.println("登录成功！"+user.name);
                            menu.showMainMeun();
                            i = sc.nextInt();
                            if (i == 0) {
                                break;
                            } else if (i == 1) {
                                menu.showCustMeun();
                                break;
                            } else if (i == 2) {
                                menu.showSendGMeun();
                                break;
                            } else {
                                System.out.println("输入错误！");
                            }
                            break;
                        }else{
                            System.out.println("您没有权限进入系统，请重新登陆！");
                            continue;
                        }
                    }
                } else if (i == 2) {
                    break;
                }
            } else {
                System.out.println("输入字符不合法！");
            }
        } while (i != -1);
        System.out.println("程序结束！");
    }
}
